SEEK={};
SEEK.Global={};
SEEK.Global.minPasswordLength=7;
SEEK.Global.minUsernameLength=5;
SEEK.Global.maxCounterLimit=500;
SEEK.Global.Effects={};
SEEK.Global.Effects.verySlow=800;
SEEK.Global.Effects.slow=600;
SEEK.Global.Effects.normal=400;
SEEK.Global.Effects.fast=300;
SEEK.Global.Effects.veryFast=150;
SEEK.Global.Regex={};
SEEK.Global.Regex.username=/^[a-zA-Z0-9@_\.\-\x20]{5,30}$/;
SEEK.Global.Regex.email=/^[_\w\.\-]+@([\w\.-]+\.)+[a-zA-Z]{2,6}$/;
SEEK.Global.Regex.passwordNumbers=/[0-9]+/;
SEEK.Global.Regex.passwordSymbols=/[^a-zA-Z0-9]+/;
SEEK.Message={};
SEEK.Message.FormInvalid="Oops - looks like you missed something";
SEEK.Message.UsernameMissing="Please provide a username";
SEEK.Message.UsernameTooShort="5 characters or more";
SEEK.Message.UsernameUnavailable="That one's unavailable";
SEEK.Message.UsernameAvailable="Cool, that one's available";
SEEK.Message.Checking="Checking...";
SEEK.Message.AjaxError="There was an error checking the username exists. Please try again later.";
SEEK.Message.EmailInvalid="Sure that's your email address?";
SEEK.Message.PasswordMissing="Please provide a password";
SEEK.Message.PasswordTooShort="7 characters or more";
SEEK.Message.PasswordTooEasy="That's too easy to guess";
SEEK.Message.PasswordAcceptable="OK, but could be stronger";
SEEK.Message.PasswordStrong="Strong, nice one";
SEEK.Message.ConfirmPasswordMissing="Please retype your password";
SEEK.Message.ConfirmPasswordNotMatching="Passwords don't match";
SEEK.Message.UsernameOrPasswordInvalid="Sure that's right? We don't know that combination";
SEEK.Message.AddNoteText="Notes are saved in My Account and only you can see them.";
SEEK.Message.NoTextToSave="No text entered?";
SEEK.Ajax={};
SEEK.Ajax.getResponse=function(actionUrl,requestData,errorMessage,method){var settings={url:actionUrl,data:requestData,type:method||"POST",dataType:"text",async:false,cache:false,error:function(){throw new Error(errorMessage||"There was an error sending data to the server. Please try again later.");
}};
var responseText=$.ajax(settings).responseText;
return responseText;
};
SEEK.Ajax.getBool=function(actionUrl,requestData,errorMessage){return eval(SEEK.Ajax.getResponse(actionUrl,requestData,errorMessage));
};
SEEK.Ajax.getJSON=function(actionUrl,requestData,errorMessage){var responseText=SEEK.Ajax.getResponse(actionUrl,requestData,errorMessage);
return eval("("+responseText+")");
};
SEEK.Ajax.getHTML=function(actionUrl,requestData,errorMessage){return SEEK.Ajax.getResponse(actionUrl,requestData,errorMessage);
};
SEEK.Cookie={};
SEEK.Cookie.getCookie=function(name){var arg=name+"=";
var argLength=arg.length;
var cookieLength=document.cookie.length;
if(document.cookie&&document.cookie.length){var i=0;
while(i<cookieLength){var j=i+argLength;
if(document.cookie.substring(i,j)==arg){return SEEK.Cookie.getCookieVal(j);
}i=document.cookie.indexOf(" ",i)+1;
if(i==0){break;
}}}return null;
};
SEEK.Cookie.getCookieVal=function(offset){var endstr=document.cookie.indexOf(";",offset);
if(endstr==-1){endstr=document.cookie.length;
}return unescape(document.cookie.substring(offset,endstr));
};
SEEK.Cookie.setCookie=function(name,value,expires,path,domain,secure){var cookie=name+"="+escape(value);
cookie+=expires?("; expires="+expires.toGMTString()):"";
cookie+=path?("; path="+path):"";
cookie+=domain?("; domain="+domain):"";
cookie+=secure?"; secure":"";
document.cookie=cookie;
};
SEEK.Cookie.clearCookie=function(name,domain){SEEK.Cookie.setCookie(name,"",new Date(2005,1,1),null,domain,false);
};
SEEK.Cookie.hideContentCookie=function(params){if(location.host.indexOf(".dev")!==-1&&(!params||!params.cookie||!params.target)){alert("hide: SEEK.Cookie.hideContentCookie({cookie: 'blah', target: '#blee'}) \ncheck: SEEK.Cookie.hideContentCookie({cookie: 'blah', target: '#blee', checkState: true})");
}else{var date=new Date();
this.checkState=params.checkState||false;
this.cookieExpiry=new Date(date.getTime()+(1000*60*60*24*params.expiry))||new Date(date.getTime()+(1000*60*60*24*90));
this.cookieName=params.cookie;
this.target=$(params.target);
if(this.checkState){if(SEEK.Cookie.getCookie(this.cookieName)){this.target.hide();
}else{this.target.fadeIn("slow");
}}else{SEEK.Cookie.setCookie(this.cookieName,date.getTime(),this.cookieExpiry);
this.target.fadeOut("slow");
}}};
SEEK.ClassToggler=function(actionLink,targetElement,toggleClass,onOpen,onClose){return this.init(actionLink,targetElement,toggleClass,onOpen,onClose);
};
SEEK.ClassToggler.prototype={init:function(actionLink,targetElement,toggleClass,onOpen,onClose){this.actionLink=actionLink;
this.toggleClass=toggleClass;
this.targetElement=targetElement;
this.onOpen=onOpen;
this.onClose=onClose;
this.open=false;
var that=this;
$(actionLink).click(function(e){that.toggleState();
e.stopPropagation();
return false;
});
return this;
},toggleState:function(){this.open=!this.open;
if(this.open){$(this.targetElement).addClass(this.toggleClass);
if(this.onOpen){this.onOpen();
}}else{$(this.targetElement).removeClass(this.toggleClass);
if(this.onClose){this.onClose();
}}},reset:function(){if(this.open){this.toggleState();
}}};
SEEK.TwoLinkClassToggler=function(openLink,closeLink,targetElement,toggleClass){return this.init(openLink,closeLink,targetElement,toggleClass);
};
SEEK.TwoLinkClassToggler.prototype={init:function(openLink,closeLink,targetElement,toggleClass){$(openLink).click(function(event){event.preventDefault();
$(targetElement).addClass(toggleClass);
});
$(closeLink).click(function(event){event.preventDefault();
$(targetElement).removeClass(toggleClass);
});
}};
SEEK.LimitCounter=function(counter,textBox,currentText,defaultText,maxChars){return this.init(counter,textBox,currentText,defaultText,maxChars);
};
SEEK.LimitCounter.prototype={init:function(counter,textBox,currentText,defaultText,maxChars){this.counter=counter;
this.textBox=textBox;
this.currentText=currentText;
this.defaultText=defaultText;
this.maxChars=maxChars;
var that=this;
var tb=$(textBox);
tb.val(currentText);
tb.keyup(function(){that.updateCounter(that.maxChars);
});
tb.focusin(function(){if($(this).val()==that.defaultText){$(this).val("");
}});
tb.focusout(function(){if($(this).val()==""){$(this).val(that.defaultText);
}});
this.updateCounter(maxChars);
return this;
},updateCounter:function(max){var text=$(this.textBox).val();
if(text.length>max){text=text.substring(0,max);
$(this.textBox).val(text);
$(this.counter).html(0);
}else{var remaining=(text==this.defaultText)?max:max-text.length;
$(this.counter).html(remaining);
}},reset:function(){$(this.textBox).val(this.currentText);
$(this.counter).html(SEEK.Global.maxCounterLimit);
},onDelete:function(){$(this.textBox).val(this.defaultText);
$(this.counter).html(SEEK.Global.maxCounterLimit);
}};
SEEK.LimitCounterReset=function(cancelLink,limitCounter,toggler){return this.init(cancelLink,limitCounter,toggler);
};
SEEK.LimitCounterReset.prototype={init:function(cancelLink,limitCounter,toggler){$(cancelLink).click(function(e){limitCounter.reset();
toggler.reset();
e.stopPropagation();
return false;
});
return this;
}};
SEEK.Form={};
SEEK.Form.createSubmitLink=function(linkID,formID){$(linkID).click(function(e){$(formID).submit();
e.stopPropagation();
return false;
});
};
SEEK.ValidationResponse=function(isValid,message){return this.init(isValid,message);
};
SEEK.ValidationResponse.prototype={init:function(isValid,message){this.isValid=isValid||false;
this.message=message||"";
return this;
}};
SEEK.Validator=function(control,eventName,validationFunction,successFunction,failureFunction){return this.init(control,eventName,validationFunction,successFunction,failureFunction);
};
SEEK.Validator.prototype={init:function(control,eventName,validationFunction,successFunction,failureFunction){this.control=control;
this.eventName=eventName;
this.validationFunction=validationFunction;
this.successFunction=successFunction;
this.failureFunction=failureFunction;
this.eventData={validator:this};
this.control.bind(this.eventName,this.eventData,this.fire);
return this;
},fire:function(e){var validator;
if(!e){e=new jQuery.Event(this.eventName);
validator=this;
}else{validator=e.data.validator;
}try{var response=validator.validationFunction(validator.control,validator.eventArgs);
var validationResponse=null;
if(typeof(response)==="boolean"){validationResponse=new SEEK.ValidationResponse(response,"");
}else{if(typeof(response)==="object"){validationResponse=response;
}else{throw new Error("Invalid response from the validation function.");
}}if(validationResponse.isValid){if(validator.successFunction){validator.successFunction(validator.control,validationResponse,validator.eventArgs);
}}else{if(validator.failureFunction){validator.failureFunction(validator.control,validationResponse,validator.eventArgs);
}e.preventDefault();
}return validationResponse.isValid;
}catch(err){alert(err.message);
e.preventDefault();
return false;
}}};
SEEK.LightboxLink=function(link,frameHref,fameHeight){return this.init(link,frameHref,fameHeight);
};
SEEK.LightboxLink.prototype={init:function(link,frameHref,fameHeight){this.link=link;
this.frameHref=(frameHref==null)?$(link).attr("href"):frameHref;
this.fameHeight=fameHeight;
return this;
}};
SEEK.Lightbox=function(overlayID,containerID,innerID,closeID,iframeID){return this.init(overlayID,containerID,innerID,closeID,iframeID);
};
SEEK.Lightbox.prototype={init:function(overlayID,containerID,innerID,closeID,iframeID){this.overlayID=overlayID;
this.containerID=containerID;
this.innerID=innerID;
this.closeID=closeID;
this.iframeID=iframeID;
this.loaded=false;
this.closedCallback=null;
this.refreshOnClose=false;
this.links=[];
var that=this;
$("#"+closeID).click(function(e){that.close(null,true);
e.preventDefault();
});
$("#"+overlayID).click(function(e){that.close(null,true);
e.preventDefault();
});
return this;
},registerLink:function(lightboxLink){var that=this;
$(lightboxLink.link).bind("click dblclick",function(e){that.open(lightboxLink.frameHref,lightboxLink.height,null);
e.preventDefault();
});
},open:function(href,height,closedCallback){var container=$("#"+this.containerID);
var overlay=$("#"+this.overlayID);
var iframe=$("#"+this.iframeID);
var inner=$("#"+this.innerID);
if(closedCallback){this.closedCallback=closedCallback;
}else{this.closedCallback=this.defaultOnClosed;
}iframe.attr("src","");
inner.css("height",height);
iframe.css("height",height);
container.addClass("IEfix");
overlay.fadeTo(0,0).show(0).fadeTo(SEEK.Global.Effects.slow,0.5);
container.fadeTo(0,0).show(0);
iframe.attr("src",href);
},onSubmit:function(){this.fadeOut();
return true;
},fadeOut:function(onComplete){var iframe=$("#"+this.iframeID);
if(onComplete){iframe.fadeTo(SEEK.Global.Effects.fast,0,onComplete);
}else{iframe.fadeTo(SEEK.Global.Effects.fast,0);
}},reopen:function(href){var iframe=$("#"+this.iframeID);
iframe.fadeTo(SEEK.Global.Effects.fast,0);
setTimeout(function(){iframe.attr("src",href);
},SEEK.Global.Effects.fast);
return false;
},load:function(href){var iframe=$("#"+this.iframeID);
iframe.attr("src",href);
},onLoaded:function(iframeHeight,innerHeight){if(iframeHeight==0&&innerHeight==0){return;
}var iframe=$("#"+this.iframeID);
var inner=$("#"+this.innerID);
iframe.css("height",iframeHeight);
if(!jQuery.support.opacity){innerHeight=innerHeight-5;
}if(!this.loaded){var container=$("#"+this.containerID);
container.delay(SEEK.Global.Effects.slow).fadeTo(SEEK.Global.Effects.slow,1,function(){container.attr("style","display:block");
container.removeClass("IEfix");
});
this.loaded=true;
}inner.animate({height:innerHeight},SEEK.Global.Effects.normal,function(){iframe.fadeTo(SEEK.Global.Effects.veryFast,1);
});
},resize:function(iframeHeight,innerHeight){var iframe=$("#"+this.iframeID);
var inner=$("#"+this.innerID);
if(!jQuery.support.opacity){innerHeight=innerHeight-5;
}iframe.css("height",iframeHeight);
inner.css("height",innerHeight);
},defaultOnClosed:function(href){if(href){if($.browser.mozilla){window.location.replace(href);
}else{window.location=href;
}}},close:function(href,isCancel){var that=this;
var container=$("#"+this.containerID);
var overlay=$("#"+this.overlayID);
var iframe=$("#"+this.iframeID);
if(!href&&this.refreshOnClose){href=window.location;
}container.addClass("IEfix").fadeTo(SEEK.Global.Effects.fast,0);
overlay.fadeTo(SEEK.Global.Effects.fast,0);
setTimeout(function(){iframe.attr("src","");
container.hide();
overlay.hide();
if(!isCancel){that.closedCallback(href);
}},SEEK.Global.Effects.fast);
this.loaded=false;
}};
SEEK.LightboxResizer=function(containerID,lightbox,domain){return this.init(containerID,lightbox,domain);
};
SEEK.LightboxResizer.prototype={init:function(containerID,lightbox,domain){this.containerID=containerID;
if(lightbox){this.lightbox=lightbox;
}else{try{this.lightbox=parent.SEEK.Global.lightbox;
}catch(e){document.domain=domain;
this.lightbox=parent.SEEK.Global.lightbox;
}}this.resize(true);
return this;
},resize:function(loading){if(this.lightbox){var iframeHeight=$("#"+this.containerID).height();
var innerHeight=$("#"+this.containerID).height();
if($(".lightbox-promo").length==0){innerHeight+=((jQuery.support.opacity)?5:12);
}if(this.iframeHeight!=iframeHeight||this.innerHeight!=innerHeight){this.iframeHeight=iframeHeight;
this.innerHeight=innerHeight;
if(loading){this.lightbox.onLoaded(iframeHeight,innerHeight);
}else{this.lightbox.resize(iframeHeight,innerHeight);
}}}},onSubmit:function(){if(this.lightbox){return this.lightbox.onSubmit();
}else{return true;
}}};
SEEK.UserValidation=function(currentUsername,usernameAvailableUrl,username,email,password,confirmPassword,form,usernameMessage,emailMessage,passwordMessage,confirmPasswordMessage,formMessage){return this.init(currentUsername,usernameAvailableUrl,username,email,password,confirmPassword,form,usernameMessage,emailMessage,passwordMessage,confirmPasswordMessage,formMessage);
};
SEEK.UserValidation.prototype={init:function(currentUsername,usernameAvailableUrl,username,email,password,confirmPassword,form,usernameMessage,emailMessage,passwordMessage,confirmPasswordMessage,formMessage){var that=this;
this.currentUsername=currentUsername;
this.validatePasswords=true;
this.usernameAvailable=(currentUsername!=="");
this.ajaxRequestComplete=true;
this.usernameMessage=usernameMessage;
username.bind("keyup focusout",function(){var val=username.val();
if(val===""){that.displayUsernameMessage(SEEK.Message.UsernameMissing,usernameMessage);
}else{if(val===that.currentUsername){that.displayUsernameMessage(SEEK.Message.UsernameAvailable,usernameMessage);
}else{if(val.length<SEEK.Global.minUsernameLength){that.displayUsernameMessage(SEEK.Message.UsernameTooShort,usernameMessage);
}else{if(!val.match(SEEK.Global.Regex.username)){that.displayUsernameMessage(SEEK.Message.UsernameUnavailable,usernameMessage);
}else{usernameMessage.html(SEEK.Message.Checking).addClass("checking");
var settings={url:usernameAvailableUrl,data:{username:val},type:"POST",dataType:"text",async:true,cache:false,success:function(responseText){that.ajaxRequestComplete=true;
that.usernameAvailable=eval(responseText);
var text=that.usernameAvailable?SEEK.Message.UsernameAvailable:SEEK.Message.UsernameUnavailable;
that.displayUsernameMessage(text,usernameMessage);
},error:function(){that.usernameAvailable=false;
that.ajaxRequestComplete=true;
throw new Error(SEEK.Message.AjaxError);
}};
$.ajax(settings);
}}}}});
var emailValidator=new SEEK.Validator(email,"focusout",function(control){var addr=control.val();
if(!addr.match(SEEK.Global.Regex.email)){return new SEEK.ValidationResponse(false,SEEK.Message.EmailInvalid);
}else{return new SEEK.ValidationResponse(true);
}},function(control,response){emailMessage.html("").attr("class","field-msg valid").hide();
},function(control,response){emailMessage.html(response.message).attr("class","field-msg invalid").show();
});
var passwordValidator=new SEEK.Validator(password,"keyup focusout",function(control){var pw=control.val();
if(pw===""){return new SEEK.ValidationResponse(false,SEEK.Message.PasswordMissing);
}else{if(pw.length<SEEK.Global.minPasswordLength){return new SEEK.ValidationResponse(false,SEEK.Message.PasswordTooShort);
}else{if(pw.toLowerCase()==="password"||pw==username.val()){return new SEEK.ValidationResponse(false,SEEK.Message.PasswordTooEasy);
}else{if(pw.match(SEEK.Global.Regex.passwordNumbers)&&pw.match(SEEK.Global.Regex.passwordSymbols)){return new SEEK.ValidationResponse(true,SEEK.Message.PasswordStrong);
}else{return new SEEK.ValidationResponse(true,SEEK.Message.PasswordAcceptable);
}}}}},function(control,response){passwordMessage.html(response.message).attr("class","field-msg valid").show();
},function(control,response){var cssClass=(response.message===SEEK.Message.PasswordTooShort)?"field-msg incomplete":"field-msg invalid";
passwordMessage.html(response.message).attr("class",cssClass).show();
});
var confirmPasswordValidator=new SEEK.Validator(confirmPassword,"focusout",function(control){var cpw=control.val();
if(cpw===""){return new SEEK.ValidationResponse(false,SEEK.Message.ConfirmPasswordMissing);
}else{if(cpw!=password.val()){return new SEEK.ValidationResponse(false,SEEK.Message.ConfirmPasswordNotMatching);
}else{return new SEEK.ValidationResponse(true);
}}},function(control,response){confirmPasswordMessage.html("").attr("class","field-msg valid").hide();
},function(control,response){confirmPasswordMessage.html(response.message).attr("class","field-msg invalid").show();
});
var formValidator=new SEEK.Validator(form,"submit",function(control,eventArgs){var isValid=that.ajaxRequestComplete&&that.usernameAvailable;
isValid=emailValidator.fire()&&isValid;
if(that.validatePasswords){isValid=passwordValidator.fire()&&isValid;
isValid=confirmPasswordValidator.fire()&&isValid;
}if(isValid){return new SEEK.ValidationResponse(true);
}else{return new SEEK.ValidationResponse(false,SEEK.Message.FormInvalid);
}},function(control,response){if(SEEK.Global.lightboxResizer){SEEK.Global.lightboxResizer.onSubmit();
}},function(control,response){formMessage.html(response.message).addClass("invalid").show();
if(SEEK.Global.lightboxResizer){SEEK.Global.lightboxResizer.resize(false);
}});
return this;
},displayUsernameMessage:function(text,usernameMessage){var cssClass="field-msg invalid";
if(text===SEEK.Message.UsernameAvailable){cssClass="field-msg valid";
}else{if(text===SEEK.Message.UsernameTooShort){cssClass="field-msg incomplete";
}}usernameMessage.html(text).attr("class",cssClass).show();
},setValidatePasswords:function(validate){this.validatePasswords=validate;
}};
SEEK.ChangePasswordForm=function(username,newPassword,newPasswordMessage,confirmPassword,confirmPasswordMessage,changePasswordForm){return this.init(username,newPassword,newPasswordMessage,confirmPassword,confirmPasswordMessage,changePasswordForm);
};
SEEK.ChangePasswordForm.prototype={init:function(username,newPassword,newPasswordMessage,confirmPassword,confirmPasswordMessage,changePasswordForm){var passwordValidator=new SEEK.Validator(newPassword,"keyup focusout",function(control){var pw=control.val();
if(pw===""){return new SEEK.ValidationResponse(false,SEEK.Message.PasswordMissing);
}else{if(pw.length<SEEK.Global.minPasswordLength){return new SEEK.ValidationResponse(false,SEEK.Message.PasswordTooShort);
}else{if(pw.toLowerCase()==="password"||pw==username.val()){return new SEEK.ValidationResponse(false,SEEK.Message.PasswordTooEasy);
}else{if(pw.match(SEEK.Global.Regex.passwordNumbers)&&pw.match(SEEK.Global.Regex.passwordSymbols)){return new SEEK.ValidationResponse(true,SEEK.Message.PasswordStrong);
}else{return new SEEK.ValidationResponse(true,SEEK.Message.PasswordAcceptable);
}}}}},function(control,response){newPasswordMessage.attr("class","field-msg valid").html(response.message).show();
},function(control,response){var cssClass=(response.message===SEEK.Message.PasswordTooShort)?"incomplete":"invalid";
newPasswordMessage.attr("class","field-msg "+cssClass).html(response.message).show();
});
var confirmPasswordValidator=new SEEK.Validator(confirmPassword,"focusout",function(control){var cpw=control.val();
if(cpw===""){return new SEEK.ValidationResponse(false,SEEK.Message.ConfirmPasswordMissing);
}else{if(cpw!=newPassword.val()){return new SEEK.ValidationResponse(false,SEEK.Message.ConfirmPasswordNotMatching);
}else{return new SEEK.ValidationResponse(true);
}}},function(control,response){confirmPasswordMessage.html("").removeClass("invalid").hide();
},function(control,response){confirmPasswordMessage.html(response.message).addClass("invalid").show();
});
var formValidator=new SEEK.Validator(changePasswordForm,"submit",function(control,eventArgs){var isValid=passwordValidator.fire();
isValid=confirmPasswordValidator.fire()&&isValid;
if(isValid){return new SEEK.ValidationResponse(true);
}else{return new SEEK.ValidationResponse(false,SEEK.Message.FormInvalid);
}},function(control,response){if(SEEK.Global.lightboxResizer){SEEK.Global.lightboxResizer.onSubmit();
}},function(control,response){if(SEEK.Global.lightboxResizer){SEEK.Global.lightboxResizer.resize(false);
}});
return this;
}};
SEEK.ForgotPasswordForm=function(email,validationMessage,forgotEmailForm){return this.init(email,validationMessage,forgotEmailForm);
};
SEEK.ForgotPasswordForm.prototype={init:function(email,validationMessage,forgotEmailForm){var formValidator=new SEEK.Validator(forgotEmailForm,"submit",function(control){if(!email.val().match(SEEK.Global.Regex.email)){return new SEEK.ValidationResponse(false,SEEK.Message.EmailInvalid);
}else{return new SEEK.ValidationResponse(true);
}},function(control,response){if(SEEK.Global.lightboxResizer){SEEK.Global.lightboxResizer.onSubmit();
}},function(control,response){validationMessage.html(response.message).show().addClass("invalid");
if(SEEK.Global.lightboxResizer){SEEK.Global.lightboxResizer.resize(false);
}});
return this;
}};
SEEK.LoginForm=function(username,password,validationMessage,loginForm){return this.init(username,password,validationMessage,loginForm);
};
SEEK.LoginForm.prototype={init:function(username,password,validationMessage,loginForm){var formValidator=new SEEK.Validator(loginForm,"submit",function(control){if(username.val()===""||password.val()===""){return new SEEK.ValidationResponse(false,SEEK.Message.UsernameOrPasswordInvalid);
}else{return new SEEK.ValidationResponse(true);
}},function(control,response){if(SEEK.Global.lightboxResizer){SEEK.Global.lightboxResizer.onSubmit();
}},function(control,response){validationMessage.html(response.message).show().addClass("invalid");
if(SEEK.Global.lightboxResizer){SEEK.Global.lightboxResizer.resize(false);
}});
return this;
}};
SEEK.Promotion={};
SEEK.Promotion.SeekLearningPromotion=function(control){return this.init(control);
};
SEEK.Promotion.SeekLearningPromotion.prototype={init:function(control){$(control).change(function(e){nextPage=this.options[this.selectedIndex].value;
if(nextPage!=""){document.location.href=nextPage;
}e.stopPropagation();
return false;
});
return this;
}};
SEEK.Promotion.SeekLearningPromoWithGo=function(control,goBtn){return this.init(control,goBtn);
};
SEEK.Promotion.SeekLearningPromoWithGo.prototype={init:function(control,goBtn){$(control).change(function(){$(control).css("background-color","#fff");
$(control).css("border","1px solid #CCC");
});
$(goBtn).click(function(e){if($(control).val()!="#"){document.location=$(control).val();
}else{$(control).css("background-color","#f0c8c7");
$(control).css("border","1px solid red");
}e.preventDefault();
});
}};
SEEK.Promotion.SeekLearningPromoGo=function(control,goBtn,newLoc){return this.init(control,goBtn,newLoc);
};
SEEK.Promotion.SeekLearningPromoGo.prototype={init:function(control,goBtn,newLoc){$(goBtn).click(function(e){if($(control).val()!="#"){document.location=$(control).val();
}else{document.location=newLoc;
}e.preventDefault();
});
}};
SEEK.Promotion.TileRandomiser=function(groups,promotions){return this.init(groups,promotions);
};
SEEK.Promotion.TileRandomiser.prototype={init:function(groups,promotions){$.each($(groups),function(i,e){var count=$(this).children(".ad").length;
if(count>0){var ind=Math.floor(Math.random()*count);
$(this).children(".ad").hide();
var ad=$(this).children(".ad").get(ind);
$(ad).show();
}});
$(promotions).addClass("display");
return this;
}};
SEEK.JobListingToolsAuthenticated=function(noteCounter,addNoteToggler,editNoteToggler,curNoteText,postDeleteNoteUrl,postSaveNoteUrl,currentJobID,saveSuccessMessage){var noteExists=true;
if(curNoteText.length==0){curNoteText=SEEK.Message.AddNoteText;
var noteExists=false;
}$("#SaveJobLink").click(function(){$.post(postSaveNoteUrl,{jobId:currentJobID,commentText:""},function(data){$(".save-job").empty();
$(".save-job").append(saveSuccessMessage);
});
});
$("#SaveNoteLink").click(function(){var noteText=$("#NoteText").val();
if((noteText=="")||(noteText==SEEK.Message.AddNoteText)){alert(SEEK.Message.NoTextToSave);
return;
}if(typeof(GetSaveJobUrlTemplate)!="undefined"){var encodedText=escape(noteText);
SEEK.Global.lightbox.open(GetSaveJobUrlTemplate.replace("template",encodedText),430);
return;
}$.post(postSaveNoteUrl,{jobId:currentJobID,commentText:noteText},function(data){var result=eval(data);
$(".edit-notes p").html(noteText);
curNoteText=noteText;
$(".edit-notes").show();
$("#AddNoteLink").hide();
addNoteToggler.reset();
editNoteToggler.reset();
});
});
$("#DeleteNoteLink").click(function(e){if(confirm("Delete personal note?")){$.post(postDeleteNoteUrl,{jobId:currentJobID},function(data){var result=eval(data);
if(result.success){$(".edit-notes p").html("");
noteCounter.onDelete();
editNoteToggler.reset();
$(".edit-notes").hide();
$("#AddNoteLink").show();
noteText="";
}});
}e.stopPropagation();
return false;
});
if(noteExists){$(".edit-notes").show();
$("#AddNoteLink").hide();
}};
SEEK.JobListingTools=function(currentJobID,postReportJobUrl){$("#SubmitFraudAdLink").click(function(){var email=$("#FraudEmail").val();
if(!loggedIn&&(email=="")){alert("We need an email to get back to you!");
return;
}var reason=$("#FraudReason").val();
if(reason==0){alert("We need a reason for reporting this job");
return;
}var comment=$("#FraudText").val();
if((reason==4)&&(comment=="")){alert("Please add a comment if you select other reason.");
return;
}$.post(postReportJobUrl,{jobId:currentJobID,email:email,reason:$("#FraudReason :selected").text(),comment:comment},function(data,textStatus){$("#ReportThisAdSuccess").show();
$("#ReportThisAd").hide();
});
});
};
SEEK.ContinueTileRotation=false;
SEEK.RotateTiles=function(containerID,settings){if(containerID){SEEK.ContinueTileRotation=true;
var currentElement=0,cycleTime=settings.cycleTime||1000,elements=0,transitionTime=settings.transitionTime||500,ie8DisableFade=settings.ie8DisableFade||false,ie8browser=($.browser.msie&&$.browser.version==8)?true:false,rotateTiles=function(){if(ie8DisableFade&&ie8browser){$(elements[currentElement]).hide();
}else{$(elements[currentElement]).fadeOut(transitionTime);
}if(currentElement===(elements.length-1)){currentElement=0;
}else{currentElement++;
}if(ie8DisableFade&&ie8browser){$(elements[currentElement]).show();
}else{$(elements[currentElement]).fadeIn(transitionTime);
}if(SEEK.ContinueTileRotation){setTimeout(rotateTiles,cycleTime);
}};
if(settings.targetElement){elements=$(containerID+" "+settings.targetElement);
}else{elements=$(containerID).children();
}if(elements.length!==0){setTimeout(rotateTiles,cycleTime);
}}};

